/**
 * @version		$Id: popups.js 36 2011-01-20 12:59:29Z happy_noodle_boy $
 * @package      JCE
 * @copyright    Copyright (C) 2005 - 2009 Ryan Demmer. All rights reserved.
 * @author		Ryan Demmer
 * @license      GNU/GPL
 * JCE is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 */

var WFAggregator = WFExtensions.add('Aggregator', {
    /**
     * Add an aggregator extension
     * @param {String} n Extension name
     * @param {Object} o Extension object
     */
    add : function(n, o) {
        WFExtensions.addExtension('aggregator', n, o);
    },
    
    /**
     * Check a value against installed extensions
     * @param {String} type, Aggregator type eg: video
     * @param {String} v URL String
     */
    check : function(type, v) {
    	var r, o, aggregators = WFExtensions.getExtension('aggregator', type);

        tinymce.each(aggregators, function(fn) {
            if (typeof fn == 'function') {
                r = fn.call(this, v);

                if (typeof r == 'object') {
                    o = r;
                }
            }
        });
        
        return o;
    }
});
